﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Week3_1_Repository.Migrations
{
    public partial class 规格 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Gdesc",
                table: "Goods");

            migrationBuilder.DropColumn(
                name: "Gprice",
                table: "Goods");

            migrationBuilder.DropColumn(
                name: "Gstock",
                table: "Goods");

            migrationBuilder.DropColumn(
                name: "Uid",
                table: "Goods");

            migrationBuilder.CreateTable(
                name: "GoodsSpec",
                columns: table => new
                {
                    GSid = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GSname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GSTid = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsSpec", x => x.GSid);
                });

            migrationBuilder.CreateTable(
                name: "GoodsSpecGuan",
                columns: table => new
                {
                    GSGid = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GSTid = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsSpecGuan", x => x.GSGid);
                });

            migrationBuilder.CreateTable(
                name: "GoodsSpecType",
                columns: table => new
                {
                    GSTid = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GSTname = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsSpecType", x => x.GSTid);
                });

            migrationBuilder.CreateTable(
                name: "SKU",
                columns: table => new
                {
                    Sid = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Scode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Stock = table.Column<int>(type: "int", nullable: false),
                    Sname = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Svalue = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Sdesc = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Simg = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SKU", x => x.Sid);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "GoodsSpec");

            migrationBuilder.DropTable(
                name: "GoodsSpecGuan");

            migrationBuilder.DropTable(
                name: "GoodsSpecType");

            migrationBuilder.DropTable(
                name: "SKU");

            migrationBuilder.AddColumn<string>(
                name: "Gdesc",
                table: "Goods",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<decimal>(
                name: "Gprice",
                table: "Goods",
                type: "decimal(18,2)",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<int>(
                name: "Gstock",
                table: "Goods",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Uid",
                table: "Goods",
                type: "int",
                nullable: false,
                defaultValue: 0);
        }
    }
}
